{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "2ebb802d-9bd7-44ee-9fae-106e16e46462",
   "metadata": {},
   "outputs": [],
   "source": [
    "from pyecharts.globals import CurrentConfig, NotebookType\n",
    "CurrentConfig.NOTEBOOK_TYPE = NotebookType.JUPYTER_LAB\n",
    "\n",
    "from pyecharts.charts import Bar\n",
    "from pyecharts import options as opts\n",
    "from pyecharts.globals import ThemeType\n",
    "bar = (\n",
    "    Bar(init_opts=opts.InitOpts(theme=ThemeType.WESTEROS))\n",
    "    .add_xaxis(['a','b'])\n",
    "    .add_yaxis('sell a', [5,20])\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"title a\", subtitle=\"sub title\"))\n",
    ")\n",
    "bar.load_javascript()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "05135874",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/v5/echarts.min', 'westeros':'https://assets.pyecharts.org/assets/v5/themes/westeros'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"635b09720bcc4c57bdaf723c07741ac6\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts', 'westeros'], function(echarts) {\n",
       "                var chart_635b09720bcc4c57bdaf723c07741ac6 = echarts.init(\n",
       "                    document.getElementById('635b09720bcc4c57bdaf723c07741ac6'), 'westeros', {renderer: 'canvas'});\n",
       "                var option_635b09720bcc4c57bdaf723c07741ac6 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"aria\": {\n",
       "        \"enabled\": false\n",
       "    },\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"sell a\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"data\": [\n",
       "                5,\n",
       "                20\n",
       "            ],\n",
       "            \"realtimeSort\": false,\n",
       "            \"showBackground\": false,\n",
       "            \"stackStrategy\": \"samesign\",\n",
       "            \"cursor\": \"pointer\",\n",
       "            \"barMinHeight\": 0,\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"barGap\": \"30%\",\n",
       "            \"large\": false,\n",
       "            \"largeThreshold\": 400,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"datasetIndex\": 0,\n",
       "            \"clip\": true,\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 2,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"sell a\"\n",
       "            ],\n",
       "            \"selected\": {},\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14,\n",
       "            \"backgroundColor\": \"transparent\",\n",
       "            \"borderColor\": \"#ccc\",\n",
       "            \"borderWidth\": 1,\n",
       "            \"borderRadius\": 0,\n",
       "            \"pageButtonItemGap\": 5,\n",
       "            \"pageButtonPosition\": \"end\",\n",
       "            \"pageFormatter\": \"{current}/{total}\",\n",
       "            \"pageIconColor\": \"#2f4554\",\n",
       "            \"pageIconInactiveColor\": \"#aaa\",\n",
       "            \"pageIconSize\": 15,\n",
       "            \"animationDurationUpdate\": 800,\n",
       "            \"selector\": false,\n",
       "            \"selectorPosition\": \"auto\",\n",
       "            \"selectorItemGap\": 7,\n",
       "            \"selectorButtonGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"enterable\": false,\n",
       "        \"confine\": false,\n",
       "        \"appendToBody\": false,\n",
       "        \"transitionDuration\": 0.4,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5,\n",
       "        \"order\": \"seriesAsc\"\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"a\",\n",
       "                \"b\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"text\": \"title a\",\n",
       "            \"target\": \"blank\",\n",
       "            \"subtext\": \"sub title\",\n",
       "            \"subtarget\": \"blank\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"textAlign\": \"auto\",\n",
       "            \"textVerticalAlign\": \"auto\",\n",
       "            \"triggerEvent\": false\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_635b09720bcc4c57bdaf723c07741ac6.setOption(option_635b09720bcc4c57bdaf723c07741ac6);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x7fe63c1df3a0>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bar.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "7bde0247-6a63-43c2-8b5b-2c03672c9468",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<!DOCTYPE html>\n",
       "<html>\n",
       "<head>\n",
       "    <meta charset=\"UTF-8\">\n",
       "</head>\n",
       "<body>\n",
       "        <div id=\"3e29c302039f4dbdbda0bb38b5a5432e\" class=\"chart-container\" style=\"width:900px; height:500px; \"></div>\n",
       "    <script>\n",
       "        var chart_3e29c302039f4dbdbda0bb38b5a5432e = echarts.init(\n",
       "            document.getElementById('3e29c302039f4dbdbda0bb38b5a5432e'), 'white', {renderer: 'canvas'});\n",
       "        var option_3e29c302039f4dbdbda0bb38b5a5432e = {\n",
       "    \"title\": {\n",
       "        \"text\": \"testa\"\n",
       "    },\n",
       "    \"tooltip\": {},\n",
       "    \"lengend\": {\n",
       "        \"data\": [\n",
       "            \"sell\"\n",
       "        ]\n",
       "    },\n",
       "    \"xAxis\": {\n",
       "        \"data\": [\n",
       "            \"a\",\n",
       "            \"b\",\n",
       "            \"c\"\n",
       "        ]\n",
       "    },\n",
       "    \"yAxis\": {},\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"name\": \"sell\",\n",
       "            \"type\": \"bar\",\n",
       "            \"data\": [\n",
       "                5,\n",
       "                20,\n",
       "                25\n",
       "            ]\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "        chart_3e29c302039f4dbdbda0bb38b5a5432e.setOption(option_3e29c302039f4dbdbda0bb38b5a5432e);\n",
       "    </script>\n",
       "</body>\n",
       "</html>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x7fa3cc25ba60>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts.charts.base import Base\n",
    "options = {\n",
    "    'title':{\n",
    "        'text':'testa'\n",
    "    },\n",
    "    'tooltip':{},\n",
    "    'lengend':{\n",
    "        'data':['sell']\n",
    "    },\n",
    "    'xAxis': {\n",
    "        'data': ['a','b','c']\n",
    "    },\n",
    "    'yAxis':{},\n",
    "    'series':[{\n",
    "        'name':'sell',\n",
    "        'type':'bar',\n",
    "        'data':[5,20,25]\n",
    "    }]\n",
    "}\n",
    "\n",
    "chart = Base()\n",
    "chart.options = options\n",
    "chart.render_notebook()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "2a18fe77-e413-40db-82a4-ad080f5e31a8",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (1688938397.py, line 1)",
     "output_type": "error",
     "traceback": [
      "\u001b[0;36m  Cell \u001b[0;32mIn[8], line 1\u001b[0;36m\u001b[0m\n\u001b[0;31m    https://blog.csdn.net/henry_23/article/details/133714650\u001b[0m\n\u001b[0m          ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    "https://blog.csdn.net/henry_23/article/details/133714650"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "825cf4b0-717b-45fd-8ae9-3022139372cd",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
